package com.guoji.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guoji.entity.TbCrmEmployee;
import com.guoji.service.TbCrmEmployeeService;
import com.guoji.mapper.TbCrmEmployeeMapper;
import com.guoji.vo.LoginUser;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;

import java.util.HashMap;
import java.util.Map;

/**
* @author hui
* @description 针对表【tb_crm_employee】的数据库操作Service实现
* @createDate 2021-12-14 21:09:40
*/
@Service
public class TbCrmEmployeeServiceImpl extends ServiceImpl<TbCrmEmployeeMapper, TbCrmEmployee> implements TbCrmEmployeeService{

    /**
     * 登录验证
     * service*/
    @Override
    public ModelMap getVerify(LoginUser loginUser) {
        ModelMap map = new ModelMap();
        TbCrmEmployee tbCrmEmployee = baseMapper.selectById(loginUser.getUsername());
        if(tbCrmEmployee != null){
            System.out.println(tbCrmEmployee);
            if (loginUser.getUsername().equals(tbCrmEmployee.getTbSystemUser().getUsername()) && loginUser.getPassword().equals(tbCrmEmployee.getTbSystemUser().getPassword())){
                map.put("userExsitjian",true);
                map.put("msg","登录成功");
            }else {
                map.put("userExsitjian",false);
                map.put("msg","账号密码错误");
            }
        }else {

            map.put("userExsitjian",false);
            map.put("msg","账号密码错误");
        }
        return map;
    }
}




